require "skynet.manager"
local skynet = require "skynet"
local log = require "Log"
-- local cluster = require "cluster"
local Manager = require "Manager"
local Message = require "Message"
local AccountManager = require "AccountManager"

skynet.start(function()

	-- local name = skynet.getenv("robot_name")
	-- if name == 'zhajinhua' then 
	-- 	skynet.uniqueservice(name)
	-- 	skynet.exit()
	-- 	return
	-- end

	local message = Message.new()
	-- local manager = Manager.new(message)
	local accountManager = AccountManager.new(message)
	skynet.dispatch("lua", message:dispatch())
	skynet.register('manager')

	local svrname = skynet.getenv("robot_name")
	if svrname then
		skynet.uniqueservice(svrname)
	end

	
	-- local name = skynet.getenv("robot_name")
	-- print(name)
	-- if name == 'test' then
	-- 	local test = skynet.uniqueservice("test")
	-- 	skynet.call(test,"lua","start")

	-- else
	-- 	skynet.uniqueservice(name)
	-- end	


	-- skynet.uniqueservice("reloadd")
	-- skynet.uniqueservice("confcenter")--各种配置
	-- local watchdog = skynet.uniqueservice("auth_manager") --主要服务
	-- skynet.call(watchdog, "lua", "start")
	-- local svr_id = skynet.getenv("svr_id")
	-- cluster.open(svr_id)--集群节点
    --skynet.exit()
end)

